package com.tcl.launcherpro.lockscreen.ad;

import android.util.Log;
import android.view.ViewGroup;

/**
 * Created by xinjue.wang on 2017/4/20.
 */
public class LockAdManagerImpl {

    private LockAdManagerImpl(){};

    private static LockAdManagerImpl instance;

    private ILockAdProxy proxy;

    public static LockAdManagerImpl getInstance(){
        if(instance == null){
            instance = new LockAdManagerImpl();
        }
        return instance;
    }

    public void setProxy(ILockAdProxy proxy) {
        this.proxy = proxy;
    }

    public void loadAD() {
        Log.d("wxj", "LockAdManagerImpl : loadAD: proxy="+proxy);
        if(proxy !=null) {
            proxy.loadAD();
        }
    }

    public void setContainer(ViewGroup v) {
        Log.d("wxj", "setContainer : loadAD: proxy="+proxy);
        if(proxy !=null) {
            proxy.setContainer(v);
        }
    }

    public boolean hasView() {
        if (proxy != null) {
            return proxy.hasView();
        }
        return false;
    }

    public void showAdView(ViewGroup v) {
        if (proxy != null) {
            proxy.showAdView(v);
        }
    }
}
